package com.hsc.yalebao.tools;

import android.content.Context;
import android.content.res.AssetManager;
import android.view.Display;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import android.widget.ListAdapter;
import android.widget.ListView;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Utility
{
  public static String getJsonFromAssets(Context paramContext, String paramString)
  {
    try
    {
      InputStreamReader localInputStreamReader = new InputStreamReader(paramContext.getAssets().open(paramString), "UTF-8");
      BufferedReader localBufferedReader = new BufferedReader(localInputStreamReader);
      StringBuilder localStringBuilder = new StringBuilder();
      while (true)
      {
        String str = localBufferedReader.readLine();
        if (str == null)
        {
          localBufferedReader.close();
          localInputStreamReader.close();
          return localStringBuilder.toString();
        }
        localStringBuilder.append(str);
      }
    }
    catch (Exception localException)
    {
    }
    return "";
  }

  public static int getScreenWidth(Context paramContext)
  {
    return ((WindowManager)paramContext.getSystemService("window")).getDefaultDisplay().getWidth();
  }

  public static int getScreenWidthHeight(Context paramContext)
  {
    return ((WindowManager)paramContext.getSystemService("window")).getDefaultDisplay().getHeight();
  }

  public static void setListViewHeightBasedOnChildren(ListView paramListView)
  {
    ListAdapter localListAdapter = paramListView.getAdapter();
    if (localListAdapter == null)
      return;
    int i = 0;
    for (int j = 0; ; j++)
    {
      if (j >= localListAdapter.getCount())
      {
        ViewGroup.LayoutParams localLayoutParams = paramListView.getLayoutParams();
        localLayoutParams.height = (i + paramListView.getDividerHeight() * (-1 + localListAdapter.getCount()));
        paramListView.setLayoutParams(localLayoutParams);
        return;
      }
      View localView = localListAdapter.getView(j, null, paramListView);
      localView.measure(0, 0);
      i += localView.getMeasuredHeight();
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tools.Utility
 * JD-Core Version:    0.6.2
 */